<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- Set render engine for 360 browser -->
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- HTML5 shim for IE8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

<link
	href="/yxtcmf/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css"
	rel="stylesheet">
<link href="/yxtcmf/public/simpleboot/css/simplebootadmin.css"
	rel="stylesheet">
<link href="/yxtcmf/public/js/artDialog/skins/default.css" rel="stylesheet" />
<link
	href="/yxtcmf/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">
<style>
.length_3 {
	width: 180px;
}

form .input-order {
	margin-bottom: 0px;
	padding: 3px;
	width: 40px;
}

.table-actions {
	margin-top: 5px;
	margin-bottom: 5px;
	padding: 0px;
}

.table-list {
	margin-bottom: 0px;
}

.progress {
	overflow: hidden;
	height: 15px;
	margin-bottom: 5px;
	background-color: #f5f5f5;
	border-radius: 4px;
	-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar-success {
	background-color: #70d445;
}

.progress-bar {
	float: left;
	width: 0%;
	height: 100%;
	font-size: 12px;
	line-height: 20px;
	color: #fff;
	text-align: center;
	background-color: #46c37b;
	-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
	-webkit-transition: width 0.6s ease;
	-o-transition: width 0.6s ease;
	transition: width 0.6s ease;
}
</style>
<!--[if IE 7]>
	<link rel="stylesheet" href="/yxtcmf/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
<script type="text/javascript">
//全局变量
var GV = {
    DIMAUB: "/yxtcmf/",
    JS_ROOT: "public/js/",
    TOKEN: ""
};
</script>
<!-- Le javascript
    ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/yxtcmf/public/js/jquery.js"></script>
<script src="/yxtcmf/public/js/wind.js"></script>
<script src="/yxtcmf/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<?php if(APP_DEBUG): ?><style>
#think_page_trace_open {
	z-index: 9999;
}
</style><?php endif; ?>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#A" data-toggle="tab"><?php echo L('WEB_SITE_INFOS');?></a></li>
			<li><a href="#B" data-toggle="tab"><?php echo L('SEO_SETTING');?></a></li>
			<li><a href="#C" data-toggle="tab"><?php echo L('URL_SETTING');?></a></li>
			<li><a href="<?php echo U('route/index');?>">URL美化</a></li>
			<li><a href="#D" data-toggle="tab">支付宝配置</a></li>
			<li><a href="#E" data-toggle="tab">云存储配置</a></li>
			<li><a href="#F" data-toggle="tab">云直播配置</a></li>
			<li><a href="#G" data-toggle="tab">短信验证码配置</a></li>
		</ul>
		<form class="form-horizontal js-ajax-form" action="<?php echo U('setting/site_post');?>" method="post">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						<div class="tab-pane active" id="A">
							<fieldset>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_NAME');?></label>
									<div class="controls">
										<input type="text" name="options[site_name]" value="<?php echo ($site_name); ?>"><span class="form-required">*</span>
										<?php if($option_id): ?>
										<input type="hidden" name="option_id" value="<?php echo ($option_id); ?>">
										<?php endif; ?>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_DOMAIN');?></label>
									<div class="controls">
										<input type="text" name="options[site_host]" value="<?php echo ($site_host); ?>"><span class="form-required">*</span>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">客服电话</label>
									<div class="controls">
										<input type="text" name="options[kefu_tel]" value="<?php echo ($kefu_tel); ?>"><span class="form-required">*</span>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">后台地址加密码：</label>
									<div class="controls">
										<input type="text" name="options[site_admin_url_password]" value="<?php echo ($site_admin_url_password); ?>" id="js-site-admin-url-password"><span class="form-required">*</span>
										<span class="help-block" style="color: red;">设置加密码后必须通过以下地址访问后台,请劳记此地址，为了安全，您也可以定期更换此加密码!</span>
										<?php $site_admin_url_password =C("SP_SITE_ADMIN_URL_PASSWORD"); ?>
										<?php if(!empty($site_admin_url_password)): ?><span class="help-block">后台地址：<span id="js-site-admin-url"><?php echo sp_get_host();?>/yxtcmf?g=admin&upw=<?php echo C('SP_SITE_ADMIN_URL_PASSWORD');?></span></span><?php endif; ?>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_THEME');?></label>
									<div class="controls">
										<select name="options[site_tpl]">
											<?php if(is_array($templates)): foreach($templates as $key=>$vo): $tpl_selected=$site_tpl==$vo?"selected":""; ?>
											<option value="<?php echo ($vo); ?>" <?php echo ($tpl_selected); ?>><?php echo ($vo); ?></option><?php endforeach; endif; ?>
										</select>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('ENABLE_MOBILE_THEME');?>：</label>
									<div class="controls">
										<?php $mobile_tpl_enabled_checked=empty($mobile_tpl_enabled)?'':'checked'; ?>
										<label class="checkbox inline"><input type="checkbox" name="options[mobile_tpl_enabled]" value="1" <?php echo ($mobile_tpl_enabled_checked); ?>></label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_ADMIN_THEME');?></label>
									<div class="controls">
										<select name="options[site_adminstyle]">
											<?php if(is_array($adminstyles)): foreach($adminstyles as $key=>$vo): $adminstyle_selected=$site_adminstyle==$vo?"selected":""; ?>
											<option value="<?php echo ($vo); ?>" <?php echo ($adminstyle_selected); ?>><?php echo ($vo); ?></option><?php endforeach; endif; ?>
										</select>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('HTML_CACHE');?>：</label>
									<div class="controls">
										<?php $html_cache_on_checked=empty($html_cache_on)?'':'checked'; ?>
										<label class="checkbox inline"><input type="checkbox" name="options[html_cache_on]" value="1" <?php echo ($html_cache_on_checked); ?>></label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_ICP');?></label>
									<div class="controls">
										<input type="text" name="options[site_icp]" value="<?php echo ($site_icp); ?>">
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBMASTER_EMAIL');?></label>
									<div class="controls">
										<input type="text" name="options[site_admin_email]" value="<?php echo ($site_admin_email); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L("WEBSITE_STATISTICAL_CODE");?></label>
									<div class="controls">
										<textarea name="options[site_tongji]" rows="5" cols="57"><?php echo ($site_tongji); ?></textarea>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_COPYRIGHT_INFOMATION');?></label>
									<div class="controls">
										<textarea name="options[site_copyright]" rows="5" cols="57"><?php echo ($site_copyright); ?></textarea>
									</div>
								</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="B">
							<fieldset>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_SEO_TITLE');?></label>
									<div class="controls">
										<input type="text" name="options[site_seo_title]" value="<?php echo ($site_seo_title); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_SEO_KEYWORDS');?></label>
									<div class="controls">
										<input type="text" name="options[site_seo_keywords]" value="<?php echo ($site_seo_keywords); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('WEBSITE_SEO_DESCRIPTION');?></label>
									<div class="controls">
										<textarea name="options[site_seo_description]" rows="5" cols="57"><?php echo ($site_seo_description); ?></textarea>
									</div>
								</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="C">
							<fieldset>
								<div class="control-group">
									<label class="control-label"><?php echo L('URL_MODE');?></label>
									<div class="controls">
										<?php $urlmodes=array( "0"=>L('URL_NORMAL_MODE'), "1"=>L('URL_PATHINFO_MODE'), "2"=>L('URL_REWRITE_MODE')); ?>
										<select name="options[urlmode]">
											<?php if(is_array($urlmodes)): foreach($urlmodes as $key=>$vo): $urlmode_selected=$key==$urlmode?"selected":""; ?>
											<option value="<?php echo ($key); ?>" <?php echo ($urlmode_selected); ?>><?php echo ($vo); ?></option><?php endforeach; endif; ?>
										</select>
										<span class="form-required">* <?php echo L('URL_MODE_HELP_TEXT');?></span>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label"><?php echo L('URL_REWRITE_SUFFIX');?></label>
									<div class="controls">
										<input type="text" name="options[html_suffix]" value="<?php echo ($html_suffix); ?>">
										<span class="form-required"><?php echo L('URL_REWRITE_SUFFIX_HELP_TEXT');?></span>
									</div>
								</div>
							</fieldset>
						</div>
						<div class="tab-pane" id="D">
							<div class="control-group">
									<label class="control-label">支付宝收款账号</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[seller_email]" value="<?php echo ($alipayconfig['seller_email']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">支付宝key</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[key]" value="<?php echo ($alipayconfig['key']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">支付宝partner</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[partner]" value="<?php echo ($alipayconfig['partner']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">notify_url</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[notify_url]" value="<?php echo ($alipayconfig['notify_url']); ?>">只需修改域名即可
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">return_url</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[return_url]" value="<?php echo ($alipayconfig['return_url']); ?>">只需修改域名即可
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">successpage</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[successpage]" value="<?php echo ($alipayconfig['successpage']); ?>">只需修改域名即可
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">errorpage</label>
									<div class="controls">
										<input type="text" style="width:500px" name="options[errorpage]" value="<?php echo ($alipayconfig['errorpage']); ?>">只需修改域名即可
									</div>
								</div>
							</div>
							<?php $qcloud1=$radio['yuntype']=='qcloud'?"checked":""; $wsview1=$radio['yuntype']=='wsview'?"checked":""; $qcloudlive=$radio['livetype']=='qcloudlive'?"checked":""; $wsviewlive=$radio['livetype']=='wsviewlive'?"checked":""; $mobileverify1=$radio['mobileverify']=='1'?"checked":""; $mobileverify0=$radio['mobileverify']=='0'?"checked":""; $qcloudlivedisplay=$radio['livetype']=='qcloudlive'?"style='display:;'":"style='display:none;'"; $wsviewlivedisplay=$radio['livetype']=='wsviewlive'?"style='display:;'":"style='display:none;'"; $qclouddisplay=$radio['yuntype']=='qcloud'?"style='display:;'":"style='display:none;'"; $wsviewdisplay=$radio['yuntype']=='wsview'?"style='display:;'":"style='display:none;'"; ?>
							<div class="tab-pane" id="E">
						
								<div class="control-group" id="video" style="background:#f5f5f5;height:40px;line-height40px;">
									<label class="control-label">视频存储位置</label>
									<label class="control-label">
										<input type="radio" name="radio1" <?php echo ($qcloud1); ?>  value="qcloud"  onchange="radioSwitch(this)" >&nbsp&nbsp&nbsp&nbsp
										腾讯cos
									</label>
									<label class="control-label">
										<input type="radio" name="radio1" <?php echo ($wsview1); ?> value="wsview"  onchange="radioSwitch(this)">&nbsp&nbsp&nbsp&nbsp
										万视无忧
									</label>  
								</div>
						       
								<div id="qcloud" <?php echo ($qclouddisplay); ?>>
								   <div class="control-group">
										<label class="control-label">APP_ID</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[APP_ID]" value="<?php echo ($tencent['APP_ID']); ?>">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">SECRET_ID</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[SECRET_ID]" value="<?php echo ($tencent['SECRET_ID']); ?>">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">SECRET_KEY</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[SECRET_KEY]" value="<?php echo ($tencent['SECRET_KEY']); ?>">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">域名空间</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[DOMAIN]" value="<?php echo ($tencent['DOMAIN']); ?>">
										</div>
									</div>
								</div>
								<div id="wsview" <?php echo ($wsviewdisplay); ?>>
								    <div class="control-group">
										<label class="control-label">用户名</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[wsviewname]" value="<?php echo ($wsview['name']); ?>">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">密码</label>
										<div class="controls">
											<input type="text" style="width:300px" name="options[wsviewpass]" value="<?php echo ($wsview['pass']); ?>">
										</div>
									</div>
								</div>
								
						</div>
						
						<div class="tab-pane" id="F">
						    <div class="control-group" id="video" style="background:#f5f5f5;height:40px;line-height40px;">
									<label class="control-label">直播平台</label>
									<label class="control-label">
										<input type="radio" name="radio"  value="qcloudlive" <?php echo ($qcloudlive); ?> onchange="radioSwitch2(this)" >&nbsp&nbsp&nbsp&nbsp
										腾讯直播
									</label>
									<label class="control-label">
										<input type="radio" name="radio"  value="wsviewlive" <?php echo ($wsviewlive); ?> onchange="radioSwitch2(this)">&nbsp&nbsp&nbsp&nbsp
										万视无忧直播
									</label>  
							</div>
							<div id="qcloudlive" <?php echo ($qcloudlivedisplay); ?>>
								<div class="control-group">
									<label class="control-label">SecretKey</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[SecretKey]" value="<?php echo ($tencent['SecretKey']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">SecretId</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[SecretId]" value="<?php echo ($tencent['SecretId']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">AppId</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[AppId]" value="<?php echo ($tencent['AppId']); ?>">
									</div>
								</div>
							</div>	
							<div id="wsviewlive" <?php echo ($wsviewlivedisplay); ?>>
							     <div class="control-group">
									<label class="control-label">用户名</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[wsviewname2]" value="<?php echo ($wsview['name2']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">密码</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[wsviewpass2]" value="<?php echo ($wsview['pass2']); ?>">
									</div>
								</div>
							</div>	
							
						</div>
						<div class="tab-pane" id="G">
						    <div class="control-group" id="video" style="background:#f5f5f5;height:40px;line-height40px;">
									<label class="control-label">是否开启短信验证码</label>
									<label class="control-label">
										<input type="radio" name="radio3"  value="1" <?php echo ($mobileverify1); ?> >&nbsp&nbsp&nbsp&nbsp
										是
									</label>
									<label class="control-label">
										<input type="radio" name="radio3"  value="0" <?php echo ($mobileverify0); ?> >&nbsp&nbsp&nbsp&nbsp
										否
									</label>  
							</div>
							<div id="qcloudlive" >
								<div class="control-group">
									<label class="control-label">App_Key</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[alidayu_app_key]" value="<?php echo ($alidayu['alidayu_app_key']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">App_Secret</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[alidayu_app_secret]" value="<?php echo ($alidayu['alidayu_app_secret']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">签名</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[smsFreeSignName]" value="<?php echo ($alidayu['smsFreeSignName']); ?>">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">模板ID</label>
									<div class="controls">
										<input type="text" style="width:300px" name="options[smsTemplateCode]" value="<?php echo ($alidayu['smsTemplateCode']); ?>">
									</div>
								</div>
							</div>	
							
						</div>
					</div>
				</div>

				<div class="form-actions">
					<button type="submit" class="btn btn-primary  js-ajax-submit"><?php echo L("SAVE");?></button>
				</div>
			</fieldset>
		</form>

	</div>
	<script type="text/javascript" src="/yxtcmf/public/js/common.js"></script>
	<script>
		/////---------------------
		$(function(){
			$("#urlmode-select").change(function(){
				if($(this).val()==1){
					alert("更改后，若发现前台链接不能正常访问，可能是您的服务器不支持PATHINFO，请先修改data/conf/config.php文件的URL_MODEL为0保证网站正常运行,在配置服务器PATHINFO功能后再更新为PATHINFO模式！");
				}
				
				if($(this).val()==2){
					alert("更改后，若发现前台链接不能正常访问，可能是您的服务器不支持REWRITE，请先修改data/conf/config.php文件的URL_MODEL为0保证网站正常运行，在开启服务器REWRITE功能后再更新为REWRITE模式！");
				}
			});
			$("#js-site-admin-url-password").change(function(){
				$(this).data("changed",true);
			});
		});
		Wind.use('validate', 'ajaxForm', 'artDialog', function() {
			//javascript
			var form = $('form.js-ajax-forms');
			//ie处理placeholder提交问题
			if ($.browser.msie) {
				form.find('[placeholder]').each(function() {
					var input = $(this);
					if (input.val() == input.attr('placeholder')) {
						input.val('');
					}
				});
			}
			//表单验证开始
			form.validate({
				//是否在获取焦点时验证
				onfocusout : false,
				//是否在敲击键盘时验证
				onkeyup : false,
				//当鼠标掉级时验证
				onclick : false,
				//验证错误
				showErrors : function(errorMap, errorArr) {
					//errorMap {'name':'错误信息'}
					//errorArr [{'message':'错误信息',element:({})}]
					try {
						$(errorArr[0].element).focus();
						art.dialog({
							id : 'error',
							icon : 'error',
							lock : true,
							fixed : true,
							background : "#CCCCCC",
							opacity : 0,
							content : errorArr[0].message,
							cancelVal : "<?php echo L('OK');?>",
							cancel : function() {
								$(errorArr[0].element).focus();
							}
						});
					} catch (err) {
					}
				},
				//验证规则
				rules : {
					'options[site_name]' : {
						required : 1
					},
					'options[site_host]' : {
						required : 1
					},
					'options[site_root]' : {
						required : 1
					}
				},
				//验证未通过提示消息
				messages : {
					'options[site_name]' : {
						required : "<?php echo L('WEBSITE_SITE_NAME_REQUIRED_MESSAGE');?>"
					},
					'options[site_host]' : {
						required : "<?php echo L('WEBSITE_SITE_HOST_REQUIRED_MESSAGE');?>"
					}
				},
				//给未通过验证的元素加效果,闪烁等
				highlight : false,
				//是否在获取焦点时验证
				onfocusout : false,
				//验证通过，提交表单
				submitHandler : function(forms) {
					$(forms).ajaxSubmit({
						url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
						dataType : 'json',
						beforeSubmit : function(arr, $form, options) {

						},
						success : function(data, statusText, xhr, $form) {
							if (data.status) {
								setCookie("refersh_time", 1);
								var admin_url_changed=$("#js-site-admin-url-password").data("changed");
								var message =admin_url_changed?data.info+'<br><span style="color:red;">后台地址已更新(请劳记！)</span>':data.info;
								
								//添加成功
								Wind.use("artDialog", function() {
									art.dialog({
										id : "succeed",
										icon : "succeed",
										fixed : true,
										lock : true,
										background : "#CCCCCC",
										opacity : 0,
										content : message,
										button : [ {
											name : "<?php echo L('OK');?>",
											callback : function() {
												reloadPage(window);
												return true;
											},
											focus : true
										}, {
											name : "<?php echo L('CLOSE');?>",
											callback : function() {
												reloadPage(window);
												return true;
											}
										} ]
									});
								});
							} else {
								alert(data.info);
							}
						}
					});
				}
			});
		});
		////-------------------------
	</script>
	<script>
	function radioSwitch(){
		var val = $('#video input[name="radio1"]:checked ').val();
		if(val=='qcloud'){
			document.getElementById("wsview").style.display="none";
            document.getElementById("qcloud").style.display="";  
		}
		if(val=='wsview'){
			document.getElementById("wsview").style.display="";
            document.getElementById("qcloud").style.display="none";	
		}
	}
	function radioSwitch2(){
		var val = $('#video input[name="radio"]:checked ').val();
		if(val=='qcloudlive'){
			document.getElementById("wsviewlive").style.display="none";
            document.getElementById("qcloudlive").style.display="";  
		}
		if(val=='wsviewlive'){
			document.getElementById("wsviewlive").style.display="";
            document.getElementById("qcloudlive").style.display="none";	
		}
	}
</script>  
</body>
</html>